package com.web.dao;

import com.web.entity.LogLogin;
import com.web.entity.LogLoginExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

/**
 * @author FDjavaone
 */
public interface LogLoginMapper {
    @SelectProvider(type=LogLoginSqlProvider.class, method="countByExample")
    int countByExample(LogLoginExample example);

    @DeleteProvider(type=LogLoginSqlProvider.class, method="deleteByExample")
    int deleteByExample(LogLoginExample example);

    @Delete({
        "delete from t_log_login",
        " where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into t_log_login (id, username,",
        " user_id, content, ",
        " sign_type, sign_address, ",
        " sign_ip, sign_time)",
        " values (#{id,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, ",
        " #{userId,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}, ",
        " #{signType,jdbcType=VARCHAR}, #{signAddress,jdbcType=VARCHAR}, ",
        " #{signIp,jdbcType=VARCHAR}, #{signTime,jdbcType=TIMESTAMP})"
    })
    int insert(LogLogin record);

    @InsertProvider(type=LogLoginSqlProvider.class, method="insertSelective")
    int insertSelective(LogLogin record);

    @SelectProvider(type=LogLoginSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="username", property="username", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="content", property="content", jdbcType=JdbcType.VARCHAR),
        @Result(column="sign_type", property="signType", jdbcType=JdbcType.VARCHAR),
        @Result(column="sign_address", property="signAddress", jdbcType=JdbcType.VARCHAR),
        @Result(column="sign_ip", property="signIp", jdbcType=JdbcType.VARCHAR),
        @Result(column="sign_time", property="signTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<LogLogin> selectByExample(LogLoginExample example);

    @Select({
        "select",
        " id, username, user_id, content, sign_type, sign_address, sign_ip, sign_time",
        " from t_log_login",
        " where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="username", property="username", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="content", property="content", jdbcType=JdbcType.VARCHAR),
        @Result(column="sign_type", property="signType", jdbcType=JdbcType.VARCHAR),
        @Result(column="sign_address", property="signAddress", jdbcType=JdbcType.VARCHAR),
        @Result(column="sign_ip", property="signIp", jdbcType=JdbcType.VARCHAR),
        @Result(column="sign_time", property="signTime", jdbcType=JdbcType.TIMESTAMP)
    })
    LogLogin selectByPrimaryKey(Long id);

    @UpdateProvider(type=LogLoginSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") LogLogin record, @Param("example") LogLoginExample example);

    @UpdateProvider(type=LogLoginSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") LogLogin record, @Param("example") LogLoginExample example);

    @UpdateProvider(type=LogLoginSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(LogLogin record);

    @Update({
        "update t_log_login",
        " set username = #{username,jdbcType=VARCHAR},",
          " user_id = #{userId,jdbcType=BIGINT},",
          " content = #{content,jdbcType=VARCHAR},",
          " sign_type = #{signType,jdbcType=VARCHAR},",
          " sign_address = #{signAddress,jdbcType=VARCHAR},",
          " sign_ip = #{signIp,jdbcType=VARCHAR},",
          " sign_time = #{signTime,jdbcType=TIMESTAMP}",
        " where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(LogLogin record);
}